home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / diskmags / 0022-3.564 / dmg-0122 / st_appl.1_5 / p_forum3 / listing2.txt < prev    next >
Text File  |  1997-04-16  |  2KB  |  54 lines

  1. /*
  2. ** Listing 2.
  3. **
  4. ** Functional equivalent to form_do. A simple drop
  5. ** in replacement which can be modified as required.
  6. */
  7.  
  8. int xform_do(tree,new_edit)
  9.  
  10. OBJECT *tree;
  11. short new_edit;
  12.  
  13. {
  14.     short cur_edit, mx, my, button, shift;
  15.     short key, click, event, pos, remain;
  16.  
  17.     cur_edit = 0;
  18.     remain = TRUE;
  19.     wind_update(BEG_MCTRL);
  20.     do
  21.         {
  22.         if (new_edit != cur_edit && new_edit)
  23.             {
  24.             if (cur_edit != 0)
  25.                 objc_edit(tree,cur_edit,0,&pos,ED_END);
  26.             cur_edit = new_edit;
  27.             objc_edit(tree,cur_edit,0,&pos,ED_INIT);
  28.             new_edit = 0;
  29.             }
  30.         event = evnt_multi(MU_KEYBD|MU_BUTTON,2,1,1,0,0,0,0,0,0,0,0,0,0,
  31.                            NULL,0,0,&mx,&my,&button,&shift,&key,&click);
  32.         if (event & MU_BUTTON)
  33.             if ((new_edit = objc_find(tree,0,9,mx,my))== -1)
  34.                 {
  35.                 Bconout(2,'\007');
  36.                 new_edit = 0;
  37.                 }
  38.             else remain = form_button(tree,new_edit,click,&new_edit);
  39.             
  40.         if (event & MU_KEYBD)
  41.             {
  42.             remain = form_keybd(tree,0,cur_edit,key,&new_edit,&key);
  43. /*            remain = xform_keybd(tree,cur_edit,shift,&new_edit,&key,&pos);*/
  44.             if (key != 0)
  45.                 objc_edit(tree,cur_edit,key,&pos,ED_CHAR);
  46.             }
  47.         }
  48.     while (remain == TRUE);
  49.     objc_edit(tree,cur_edit,0,&pos,ED_END);
  50.     wind_update(END_MCTRL);
  51.     return((int)new_edit);
  52. }
  53.  
  54.